import com.mysql.jdbc.Connection;

public class TestConnection {

    public static void main(String[] args) {
        ThreadConnection threadConnection = new ThreadConnection();
        for(int i = 1; i < 6; i++){
            Thread thread = new Thread(threadConnection, "线程i获取到的连接：" + i);
            thread.start();
        }
    }
}

class ThreadConnection implements Runnable{

    public void run(){
        //每个线程进行10个连接
        for(int i = 0; i < 10; i++){
            Connection connection = ConnectionPoolManager.getConnection();
            System.out.println(Thread.currentThread().getName() + ",connection: " + connection);
            ConnectionPoolManager.releaseConnection(connection);
        }
    }
}
